package com.hs.communication.common.feign;

import com.hs.common.core.constant.SecurityConstants;
import com.hs.common.core.constant.ServiceNameConstants;
import com.hs.common.core.domain.Result;
import com.hs.communication.common.entity.UpsData;
import com.hs.communication.common.entity.vo.DeviceVo;
import com.hs.communication.common.fallback.RemoteUpsFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * 远程调用 ups 服务
 */
@FeignClient(contextId = "remoteUpsService", value = ServiceNameConstants.UPS_SERVICE, fallbackFactory = RemoteUpsFallbackFactory.class)
public interface RemoteUpsService {

    /**
     * 获取Ups统计数据
     */
    @GetMapping(value = "/ups/statistics")
    Result<DeviceVo> getStatistics(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
    /**
     * 插入ups实时数据
     *
     * @param upsData,source
     */
    @PostMapping(value = "/ups/data")
    void insert(@RequestBody UpsData upsData, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
